//
//  todayListSoundTableViewCell.m
//  A Cup
//
//  Created by dllo on 15/4/22.
//  Copyright (c) 2015年 doll. All rights reserved.
//

#import "todayListSoundTableViewCell.h"
#define WIDTH self.contentView.frame.size.width
@implementation todayListSoundTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.headLabel = [[UILabel alloc] init];
        self.headLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.headLabel];
        [self.headLabel release];
        
        self.soundImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.soundImageView];
        [self.soundImageView release];
        
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.titleLabel];
        [self.titleLabel release];
        
        self.authorLabel = [[UILabel alloc] init];
        self.authorLabel.font = [UIFont systemFontOfSize:14];
        self.authorLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.authorLabel];
        [self.authorLabel release];
        
        self.playImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.playImageView];
        [self.playImageView release];
        
        self.likeImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.likeImageView];
        [self.likeImageView release];
        
        self.likeLabel = [[UILabel alloc] init];
        self.likeLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.likeLabel];
        [self.likeLabel release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.headLabel.frame = CGRectMake(30, 10, WIDTH, 20);

    self.soundImageView.frame = CGRectMake(60, 40, WIDTH - 120, 140);

    self.titleLabel.frame = CGRectMake(0, 198, WIDTH, 40);

    self.authorLabel.frame = CGRectMake(0, 235, WIDTH, 20);
    
    UIImage *playImage = [UIImage imageNamed:@"play"];
    self.playImageView.image = playImage;
    self.playImageView.alpha = 0.8;
    self.playImageView.frame = CGRectMake(WIDTH / 2 - 15, 165, 30, 30);
    
    UIImage *likeImage = [UIImage imageNamed:@"like"];
    self.likeImageView.image = likeImage;
    self.likeImageView.frame = CGRectMake(0.693 * WIDTH, 272, 18, 18);
    
    self.likeLabel.frame = CGRectMake(0.7653 * WIDTH, 272, 60, 18);
}

- (void)dealloc
{
    [_headLabel release];
    [_soundImageView release];
    [_titleLabel release];
    [_authorLabel release];
    [_playImageView release];
    [_likeImageView release];
    [_likeLabel release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
